<!DOCTYPE html>
<html>
<head>

<!-- meta tags -->
<meta charset="utf-8">
<meta name="keywords" content="bootstrap 4, premium, multipurpose, ecommerce, html5, CSS" />
<meta name="description" content="Bootstrap 4 Landing Page Template" />
<meta name="author" content="www.themesground.com" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Title -->
<title>佩奇牧场-登录</title>

<!-- Favicon Icon -->
<link rel="shortcut icon" href="../assets/images/pagepig.ico" />

<!-- inject css start -->

<link href="../assets/css/theme-plugin.css" rel="stylesheet" />
<link href="../assets/css/theme.min.css" rel="stylesheet" />

<!-- inject css end -->

</head>

<body>

<div class="head"></div>
<!-- page wrapper start -->
<div class="page-wrapper"> 
  
  <!-- preloader start -->
  
  <div id="ht-preloader">
    <div class="loader clear-loader"> <img class="img-fluid" src="../assets/images/loader.gif" alt=""> </div>
  </div>
  
  <!-- preloader end --> 

<!--body content start-->
<!-- 引入head -->
<div class="page-content">

<!--login start-->

<section class="bg-light">
  <div class="container">
    <div class="row justify-content-center">
      <div class="col-12 col-lg-6 col-md-8 col-sm-11">
        <div class="shadow p-6 login bg-white">
         <div class="store-name">佩奇牧场</div>
          <h4 class="text-left mb-3 font-w-5">登录</h4>
          <form id="contact-form" method="post" action="php/contact.php">
            <div class="messages"></div>
            <div class="form-group">
              <input id="form_username" type="text" name="username" class="form-control" placeholder="用户名" required data-error="请输入用户名">
              <div class="help-block with-errors"></div>
            </div>
            <div class="form-group">
              <input id="form_password" type="password" name="password" class="form-control" placeholder="密码" required data-error="请输入密码">
              <div class="help-block with-errors"></div>
            </div>
            <div class="form-group mt-4 mb-5">
              <div class="remember-checkbox d-flex align-items-center justify-content-between">
                <div class="checkbox">
                  <input type="checkbox" id="check2" name="check2">
                  <label for="check2">记住我</label>
                </div>
                 <a href="#">忘记密码</a>
              </div>
            </div> <a href="#" class="btn btn-primary btn-block" onclick="login()">登录</a>
           
           
          </form>
         
                <span class="text-muted mr-1">没有账户?</span>
                   <a href="signup.html">立即注册</a>
                </div>
        </div>
      </div>
    </div>
  </div>
</section>



</div>

<!--body content end--> 



</div>

<!-- page wrapper end -->




<!--back-to-top start-->

<div class="scroll-top"><a class="smoothscroll" href="#top"><i class="las la-angle-up"></i></a></div>

<!--back-to-top end-->
<!-- 引入footer -->
<div class="footer"></div>
<!-- inject js start -->

<script src="../assets/js/jquery-3.5.1.min.js"></script> <script src="../assets/js/popper.min.js"></script>
<script src="../assets/js/bootstrap.min.js"></script>
<!--<script src="../assets/js/owl.carousel.min.js"></script>-->
<script src="../assets/js/light-slider.js"></script>
<script src="../assets/js/parallax.js"></script>
<script src="../assets/js/magnific-popup.min.js"></script>
<script src="../assets/js/jquery.countdown.min.js"></script>
<script src="../assets/js/jquery.dd.min.js"></script>
<script src="../assets/js/validator.js"></script>
<script src="../assets/js/wow.js"></script>
<script src="../assets/js/theme-script.js"></script>

<!-- inject js end -->
<script>
  function login(){
    var _password = $("#form_password").val();
    var _username = $("#form_username").val();
   $.ajax({
     type:'POST',
     url:"/user/doLogin",
     contentType:"application/x-www-form-urlencoded; charset=utf-8",
     data:{username:_username,password:_password},
     dataType:'json',
     success:function(result){
       if(result.status==200){
         //登录成功,去主页面
         window.location.href = 'index.html';
       }else{
         //登录失败
         alert(result.msg);
       }
     },
       error:function (){alert("用户名或密码错误")}
   })

  }



</script>
<script type="text/javascript">
    //在js中引入head与footer
    $(document).ready(function () {
        $('.head').load('head.html');
        $('.footer').load('footer.html');
    });
</script>


</body>
</html>
